package com.freedom.admin.infrastructure.persistence.repository;

import com.freedom.admin.domain.repository.SysUserRoleRepository;
import com.freedom.admin.infrastructure.persistence.mapper.SysUserRoleMapper;
import com.freedom.admin.infrastructure.persistence.pojo.po.SysUserRolePO;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysUserRoleRepositoryImpl implements SysUserRoleRepository {

    private SysUserRoleMapper sysUserRoleMapper;

    @Override
    public void saveBatch(List<SysUserRolePO> list) {
        sysUserRoleMapper.saveBatch(list);
    }

    @Override
    public List<SysUserRolePO> findByUserId(Integer userId) {
        return sysUserRoleMapper.selectByUserId(userId);
    }

    @Override
    public void removeByUserId(Integer userId) {
        sysUserRoleMapper.deleteByUserId(userId);
    }

    @Override
    public void removeByUserIds(List<Integer> userIds) {
        sysUserRoleMapper.deleteByUserIds(userIds);
    }

    @Override
    public void removeByRoleIds(List<Integer> roleIds) {
        sysUserRoleMapper.deleteByRoleIds(roleIds);
    }
}
